// custom-modal.js
Component({
  properties: {
    position: {
      type: String,
      value: 'center'
    }
  },
  methods: {
    preventTouchMove() {
      // 阻止事件冒泡，防止背景滚动
    },
    show(duration = 200) {
      // 显示弹窗的动画
      const animation = wx.createAnimation({
        duration: duration,
        timingFunction: 'ease'
      }) as any;
      this.animation = animation;
      animation.opacity(1).step();
      this.setData({
        animationData: animation.export()
      });
    },
    hide(duration = 200) {
      // 隐藏弹窗的动画
      const animation = wx.createAnimation({
        duration: duration,
        timingFunction: 'ease'
      });
      this.animation = animation;
      animation.opacity(0).step();
      this.setData({
        animationData: animation.export()
      });
    }
  }
});